#include "include/bRigidBody.h"

// creates a new rigidBody
BBDECL bRigidBody* __stdcall _createRigidBody(bBullet* bullet, CSTyp typ, float mass, int playerControlled, bVector3* size, bVector3* pos)
{
	return new bRigidBody(bullet, typ, mass, playerControlled, size, pos);
}

// removes the body from the dynamic world
BBDECL void __stdcall _removeRigidBodyFromWorld(bBullet* bullet, bRigidBody* body)
{
	body->removeFromWorld(bullet);
}

// deletes the rigidBody
BBDECL void __stdcall _deleteRigidBody(bBullet* bullet, bRigidBody* body)
{
	body->removeFromWorld(bullet);
	delete body;
}

// returns the position of the rigidbody
BBDECL void __stdcall _getRigidBodyPosition(bRigidBody* body, bVector3* vec)
{
	return body->getPosition(vec);
}

// sets the position of the rigidBody
BBDECL void __stdcall _setRigidBodyPosition(bRigidBody* body, bVector3* pos)
{
	body->setPosition(pos);
}

// returns the rotation of the rigidbody
BBDECL void __stdcall _getRigidBodyRotation(bRigidBody* body, bQuaternion* rot)
{
	body->getRotation(rot);
}

// translate the rigidbody
BBDECL void __stdcall _translateRigidBody(bRigidBody* body, float x, float y, float z)
{
	body->translate(x, y, z);
}

// makes an rigidBody controlled by the user
BBDECL void __stdcall _userControlledBody(bRigidBody* body)
{
	body->isKinematic();
	body->disableDeactivation();
}

BBDECL void __stdcall _pitchRigidBody(bRigidBody* body, float x)
{
	body->pitch(x);
}

BBDECL void __stdcall _yawRigidBody(bRigidBody* body, float y)
{
	body->yaw(y);
}

BBDECL void __stdcall _rollRigidBody(bRigidBody* body, float z)
{
	body->roll(z);
}

// b3d style
BBDECL bVector3* __stdcall bb_getRigidBodyPosition(bRigidBody* body)
{
	return body->bb_getPosition();
}

BBDECL bQuaternion* __stdcall bb_getRigidBodyRotation(bRigidBody* body)
{
	return body->bb_getRotation();
}